////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   ITEM_CATEGORY
// AUTHOR           :   Alex Cheung 
// DATE CREATE      :   2006/01/20
// DESCRIPTION      :   a FORM file for the function, ITEM_CATEGORY
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/01/20   Alex Cheung     1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.catalog.itemCategory.web;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.erp.app.catalog.itemLine.web.ItemLineRow;
import com.erp.app.util.web.ActionErrorUtil;
import com.erp.app.util.web.WebUtil;
import com.erp.framework.controller.form.SimplePageEditStyleForm;
import com.erp.framework.util.CommonUtil;
import com.erp.framework.util.logger.Logger;

/**
* <p>A <strong>PageEditForm</strong> is a JavaBean which provides property
* getter and setter methods for all of the bean properties, and implements
* <code>Serializable</code>, as required by the JavaBean specification
* The main purpose for this bean is to get the user search criteria input
* and to get the user input from the web browsers.
* from the web browsers.
* As the name implies, it will only handle one-page-edit documents.
*
* @author          Alex Cheung 
* @version 1.0     2006/01/20
* @since           FrameWork 1.0
*
*/
public class ItemCategoryForm extends SimplePageEditStyleForm {

	private String editItemCategory;
	
	public String getEditItemCategory() { return editItemCategory; }
	public void setEditItemCategory(String editItemCategory) { this.editItemCategory = editItemCategory; }
	
	//Attributes (DB Table Name: T_ITEM_CATEGORY)
	private String[] companyCode;                    //DB Column Name: COMPANY_CODE
	private String[] categoryItemLine;                       //DB Column Name: ITEM_LINE
	private String[] categoryItemCategory;                   //DB Column Name: ITEM_CATEGORY
	private String[] itemCategoryDesc;               //DB Column Name: ITEM_CATEGORY_DESC
	private String[] status;                         //DB Column Name: STATUS
	private String[] dcInd;                          //DB Column Name: DC_IND
	private String[] dcDate;                         //DB Column Name: DC_DATE
	private String[] createUser;                     //DB Column Name: CREATE_USER
	private String[] createDate;                     //DB Column Name: CREATE_DATE
	private String[] updateUser;                     //DB Column Name: UPDATE_USER
	private String[] updateDate;                     //DB Column Name: UPDATE_DATE
	private String[] browser;

	//Searching Criteria Attributes (DB Table Name: T_ITEM_CATEGORY)
	private String srchCompanyCode;                  //DB Column Name: COMPANY_CODE
	private String srchStatus;                       //DB Column Name: STATUS
	private String srchItemLineFr;                   //DB Column Name: ITEM_LINE
	private String srchItemLineTo;                   //DB Column Name: ITEM_LINE
	private String srchItemCategoryFr;               //DB Column Name: ITEM_CATEGORY
	private String srchItemCategoryTo;               //DB Column Name: ITEM_CATEGORY
	private String srchItemCategoryDescFr;           //DB Column Name: ITEM_CATEGORY_DESC
	private String srchItemCategoryDescTo;           //DB Column Name: ITEM_CATEGORY_DESC
	private String srchBrowser;
	
	/**
	* Converts to a string representing the data in this object.
	* A new <code>String</code> object is allocated and initialized to 
	* contain the character sequence currently represented by this 
	* object. This <code>String</code> is then returned. Subsequent 
	* changes to this object do not affect the contents of the 
	* <code>String</code>. 
	*
	* @return     a string representation of the object.
	* @see        java.lang.Object#toString()
	* @author     Alex Cheung 
	* @since      FrameWork 1.0
	*/
	public String toString() {
		String pkStr = "PK: {srchItemLineFr = " + this.srchItemLineFr
			+ "\n, srchItemLineTo = " + this.srchItemLineTo
			+ "\n, srchItemCategoryFr = " + this.srchItemCategoryFr
			+ "\n, srchItemCategoryTo = " + this.srchItemCategoryTo + "}\n";

		String colStr = "COL: {srchItemCategoryDescFr = " + this.srchItemCategoryDescFr
			+ "\n, srchItemCategoryDescTo = " + this.srchItemCategoryDescTo + "}\n";

		String mandatoryStr = "{srchCompanyCode = " + this.srchCompanyCode
			+ "\n, srchStatus = " + this.srchStatus
			+ "}\n";

		return "toString() is:\n" + mandatoryStr + pkStr + colStr;
	}

	
	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      the action errors array
	* @author     Alex Cheung 
	* @since      FrameWork 1.0
	*/
	public void validateSearch(ActionErrors errors) {

		/*
		ArrayList rows = getMultiRows(0);

		for (int i = 0; rows != null && i < rows.size(); i++) {
			ItemCategoryRow row = (ItemCategoryRow) rows.get(i);

			if (CommonUtil.isEmpty(row.getShipDate())) {
				ActionErrorUtil.addErrorForGeneralFieldBlank(errors, "Ship Date");
			} else {
				if (!CommonUtil.isValidDate(row.getShipDate())) {
					ActionErrorUtil.addErrorForInvalidDate(errors, "Ship Date");
				}
			}
		}
		*/
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      mapping      the action mapping
	* @param      formIn       the action form
	* @param      request      the http request
	* @param      response     the http response
	* @param      errors       the action errors array
	* @author     Alex Cheung 
	* @since      FrameWork 1.0
	*/
	public void moreValidateSearch(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {


		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Reset all bean properties to their default state.  This method
	* is called inside the reset() method.
	*
	* @param      mapping The mapping used to select this instance
	* @param      request The servlet request we are processing
	* @author     Alex Cheung 
	* @since      FrameWork 1.0
	*/
	public void otherReset(ActionMapping mapping, HttpServletRequest request) {

		setRowMode(null);
		setIdx(null);
		//companyCode = null;
		//srchCompanyCode = null;
	}
	
	protected void otherValidate(ActionErrors errors) {
		ArrayList rows = getMultiRows();
		
		if (rows != null && rows.size() > 0) {
			for (int i=0; i<rows.size(); i++) {
				ItemCategoryRow row = (ItemCategoryRow) rows.get(i);

                if (row == null || !CommonUtil.isEmpty(row.getIsDelete())) 
                	continue;
            	if (CommonUtil.isEmpty(row.getItemCategoryDesc())) {
                    ActionErrorUtil.addErrorForGeneralFieldBlank(errors, ts.getDisplayWebLabelByObjectId("LBL_GRID_ITEM_CATEGORY_DESC"));
                } else {
                    row.setItemCategoryDesc(row.getItemCategoryDesc().trim());
                }
				/*
				if (row == null) continue;
				
				String rowItemCategory = row.getCategoryItemCategory();				
				if (CommonUtil.isEmpty(rowItemCategory)) {
					ActionErrorUtil.addErrorForGeneralFieldBlank(errors, "Item Category");
				} else {
					row.setCategoryItemCategory(rowItemCategory.toUpperCase());
				}
                WebUtil.validateCode(row.getCompanyCode(), row.getTs().getDisplayWebLabelByObjectId("LBL_GRID_COMPANY_CODE"), errors);
                WebUtil.validateCode(row.getCategoryItemLine(), row.getTs().getDisplayWebLabelByObjectId("LBL_GRID_ITEM_LINE"), errors);
                WebUtil.validateCode(row.getCategoryItemCategory(), row.getTs().getDisplayWebLabelByObjectId("LBL_GRID_ITEM_CATEGORY"), errors);*/
			}
		}
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for Table (ItemCategory)
	////////////////////////////////////////////////////////////////////////////////

	public String[] getCompanyCode() {
		return this.companyCode;
	}

	public String[] getCategoryItemLine() {
		return this.categoryItemLine;
	}

	public String[] getCategoryItemCategory() {
		return this.categoryItemCategory;
	}

	public String[] getItemCategoryDesc() {
		return this.itemCategoryDesc;
	}

	public String[] getStatus() {
		return this.status;
	}

	public String[] getDcInd() {
		return this.dcInd;
	}

	public String[] getDcDate() {
		return this.dcDate;
	}

	public String[] getCreateUser() {
		return this.createUser;
	}

	public String[] getCreateDate() {
		return this.createDate;
	}

	public String[] getUpdateUser() {
		return this.updateUser;
	}

	public String[] getUpdateDate() {
		return this.updateDate;
	}

	public void setCompanyCode(String[] companyCode) {
		this.companyCode = companyCode;
	}

	public void setCategoryItemLine(String[] categoryItemLine) {
		this.categoryItemLine = categoryItemLine;
	}

	public void setCategoryItemCategory(String[] categoryItemCategory) {
		this.categoryItemCategory = categoryItemCategory;
	}

	public void setItemCategoryDesc(String[] itemCategoryDesc) {
		this.itemCategoryDesc = itemCategoryDesc;
	}

	public void setStatus(String[] status) {
		this.status = status;
	}

	public void setDcInd(String[] dcInd) {
		this.dcInd = dcInd;
	}

	public void setDcDate(String[] dcDate) {
		this.dcDate = dcDate;
	}

	public void setCreateUser(String[] createUser) {
		this.createUser = createUser;
	}

	public void setCreateDate(String[] createDate) {
		this.createDate = createDate;
	}

	public void setUpdateUser(String[] updateUser) {
		this.updateUser = updateUser;
	}

	public void setUpdateDate(String[] updateDate) {
		this.updateDate = updateDate;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for searching criterias
	////////////////////////////////////////////////////////////////////////////////

	public String getSrchCompanyCode() {
		return this.srchCompanyCode;
	}

	public String getSrchStatus() {
		return this.srchStatus;
	}

	public String getSrchItemLineFr() {
		return this.srchItemLineFr;
	}

	public String getSrchItemLineTo() {
		return this.srchItemLineTo;
	}

	public String getSrchItemCategoryFr() {
		return this.srchItemCategoryFr;
	}

	public String getSrchItemCategoryTo() {
		return this.srchItemCategoryTo;
	}

	public String getSrchItemCategoryDescFr() {
		return this.srchItemCategoryDescFr;
	}

	public String getSrchItemCategoryDescTo() {
		return this.srchItemCategoryDescTo;
	}

	public void setSrchCompanyCode(String srchCompanyCode) {
		this.srchCompanyCode = srchCompanyCode;
	}

	public void setSrchStatus(String srchStatus) {
		this.srchStatus = srchStatus;
	}

	public void setSrchItemLineFr(String srchItemLineFr) {
		this.srchItemLineFr = srchItemLineFr;
	}

	public void setSrchItemLineTo(String srchItemLineTo) {
		this.srchItemLineTo = srchItemLineTo;
	}

	public void setSrchItemCategoryFr(String srchItemCategoryFr) {
		this.srchItemCategoryFr = srchItemCategoryFr;
	}

	public void setSrchItemCategoryTo(String srchItemCategoryTo) {
		this.srchItemCategoryTo = srchItemCategoryTo;
	}

	public void setSrchItemCategoryDescFr(String srchItemCategoryDescFr) {
		this.srchItemCategoryDescFr = srchItemCategoryDescFr;
	}

	public void setSrchItemCategoryDescTo(String srchItemCategoryDescTo) {
		this.srchItemCategoryDescTo = srchItemCategoryDescTo;
	}
	public String[] getBrowser() {
		return browser;
	}
	public String getSrchBrowser() {
		return srchBrowser;
	}
	public void setBrowser(String[] browser) {
		this.browser = browser;
	}
	public void setSrchBrowser(String srchBrowser) {
		this.srchBrowser = srchBrowser;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Other Accessors (get/set methods)
	////////////////////////////////////////////////////////////////////////////////


}